<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            height: 2000px;
            width: 100px;
            background-color: lightpink;
        }
    </style>
</head>
<body>
    <button>点击我卷去</button>
    <div>
        
    </div>
    <script>
        var btnEle = document.querySelector("button");
        window.onscroll = function (){
            var res = document.documentElement.scrollTop ; 
        }
        btnEle.onclick = function () {
            document.documentElement.scrollTop = 500 ;
        }
    </script>
</body>
</html>